import cv2
from utils.config_loader import cfg

# "rtsp://admin:juhui2025@192.168.50.25:554/Streaming/Channels/102"
class VideoStream:
    def __init__(self):
        self.source = cfg.get('VideoStream', 'source')
        print('source is',self.source)
        self.cap = cv2.VideoCapture(self.source)
        
    def get_frame(self):
        success, img = self.cap.read()
        return img if success else None
    
    def release(self):
        self.cap.release()